//
//  requestLogin.m
//  HHNMobileCore
//
//  Created by huihu on 15/7/26.
//  Copyright (c) 2015年 huhmf. All rights reserved.
//

#import "requestLoginApi.h"
#import "CommonFileUtils.h"


@interface requestLoginApi()

@property(nonatomic,strong) NSString *username;

@property(nonatomic,strong) NSString *password;

@property(nonatomic,strong) NSString *code;
@end
@implementation requestLoginApi

-(id)initWithUsername:(NSString *)username password:(NSString *)password code:(NSString *)code {
    self = [super init];
    if (self) {
        _username = username;
        _password = password;
        _code=code;
    }
    return self;
}

-(NSInteger)cacheTimeInSeconds
{
    return -60*1;//为负数 不启用缓存
}

-(id)requestArgument
{
    return @{
             @"userName": [_username length]?_username:@"",
             @"password": [_password length]?_password:@"",
             @"code": [_code length]?_code:@"-1"
             };
}


-(YTKRequestMethod)requestMethod
{
    return YTKRequestMethodPOST;
}

-(NSString *)requestUrl
{
    return @"/login/login.do";
}

-(NSDictionary *)requestHeaderFieldValueDictionary
{
    NSMutableURLRequest *request_M=(NSMutableURLRequest *)[super requestTask].currentRequest;
    NSString *strUrl=[NSString stringWithFormat:@"%@%@",appBaseURL,[self requestUrl]];
    NSDictionary *dict=[[HHNUtility sharedHHNInstance] setHttpHeaderWithUrl:strUrl Request:request_M];
    
    return dict;
}

@end
